<template>
    <van-row>
        <van-col span="6">

            <van-sidebar v-model="active">
                <van-sidebar-item v-for="item in categoriesApiData" :title="item.cat_name" />
            </van-sidebar>

        </van-col>

        <van-col span="18">
            <Swipe></Swipe>
            <div v-for="item in categoriesApiData[active]?.children">
                <h3>{{ item.cat_name }}</h3>
                <router-link :to="'/sea/' + item.cat_name">
                    <van-grid>
                        <van-grid-item v-for="item in item.children" :icon="item.cat_icon" :text="item.cat_name" />

                    </van-grid>
                </router-link>

            </div>
        </van-col>

    </van-row>

</template>

<script setup>
import { ref } from 'vue'
import { categoriesApi } from '@/api/api'
import Swipe from '@/components/Swipe.vue';

const categoriesApiData = ref([])
categoriesApi().then(res => {
    console.log('分类数据', res);
    categoriesApiData.value = res.data.message
})
const active = ref(1);
</script>

<style lang="scss" scoped></style>